/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrateur
 */
@Entity
@Table(name = "pays_client")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PaysClient.findAll", query = "SELECT p FROM PaysClient p"),
    @NamedQuery(name = "PaysClient.findByIdpaysClient", query = "SELECT p FROM PaysClient p WHERE p.idpaysClient = :idpaysClient"),
    @NamedQuery(name = "PaysClient.findByDescription", query = "SELECT p FROM PaysClient p WHERE p.description = :description")})
public class PaysClient implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idpays_client")
    private Integer idpaysClient;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPays")
    private Collection<Client> clientCollection;

    public PaysClient() {
    }

    public PaysClient(Integer idpaysClient) {
        this.idpaysClient = idpaysClient;
    }

    public PaysClient(Integer idpaysClient, String description) {
        this.idpaysClient = idpaysClient;
        this.description = description;
    }

    public Integer getIdpaysClient() {
        return idpaysClient;
    }

    public void setIdpaysClient(Integer idpaysClient) {
        this.idpaysClient = idpaysClient;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Client> getClientCollection() {
        return clientCollection;
    }

    public void setClientCollection(Collection<Client> clientCollection) {
        this.clientCollection = clientCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpaysClient != null ? idpaysClient.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaysClient)) {
            return false;
        }
        PaysClient other = (PaysClient) object;
        if ((this.idpaysClient == null && other.idpaysClient != null) || (this.idpaysClient != null && !this.idpaysClient.equals(other.idpaysClient))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.PaysClient[ idpaysClient=" + idpaysClient + " ]";
    }
    
}
